const global = getApp().globalData;
const Api = global.Api;
const wxApi = global.wxApi;
Page({
  data: {
    inputText: ""
  },
  onLoad() {
    wxApi.setNavTitle('意见反馈')
  },
  onTextChange(e) {
    let val = e.detail.value
    
    this.setData({
      inputText: val
    })
  },
  submitFeedback() {
    let inputText = this.data.inputText;
    let params = {
      content: inputText
    }
    Api.feedback( params, (res, code) => {
      if ( code === 0 ) {
        wx.showToast({
          title: '提交成功',
          icon: 'success'
        });
        setTimeout(() => {
          wx.navigateBack()
        }, 500);
      }
    } )
  }
})